package com.itheima.stream;

import java.util.*;
import java.util.stream.Stream;

/**
 * @author Anomaly
 * @date 2023/2/6 15:21
 */
public class StreamDemo2 {
    public static void main(String[] args) {
        //Collection获取流
        List<String> list = new ArrayList<>();
        Stream<String> stream = list.stream();

        //Map获取流
        Map<String, Integer> map = new HashMap<>();
        //键流
        Stream<String> stream1 = map.keySet().stream();
        //值流
        Stream<Integer> stream2 = map.values().stream();
        //键值对流
        Stream<Map.Entry<String, Integer>> stream3 = map.entrySet().stream();

        //数组获取流，两种方式
        String[] names = new String[]{"张三丰", "张无忌", "周芷若", "赵敏", "张强"};
        Stream<String> stream4 = Arrays.stream(names);
        Stream<String> stream5 = Stream.of(names);
    }
}
